package lab03.test04;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test04 {
    public static void main(String[] args) {
        //复制文件的操作

        String source = "D:\\Test.txt";
        String target = "D:\\Test02.txt";

        //字节流的方式来读写文件

        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;

        try {
            fileInputStream = new FileInputStream(source);
            fileOutputStream = new FileOutputStream(target);

            int data;

            //读一个字节马上就写一个字节
                while ((data = fileInputStream.read()) != -1){
                    fileOutputStream.write(data);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }finally {

        }

        }
    }

